<template>
	<div>
		<uni-list>
			<uni-list-item title="司机姓名" :rightText="formData.driverName" />
			<uni-list-item title="性别" :rightText="sex_[formData.sex]" />
			<uni-list-item title="身份证号" :rightText="formData.idCardNo" />
			<uni-list-item title="司机类型" :rightText="driverType_[formData.driverType]" />
			<uni-list-item title="所在地址" :rightText="formData.addressDistrictName+''+formData.address" />
			<uni-list-item title="手机号码" :rightText="formData.phoneNumber" />
			<uni-list-item title="驾照类型" :rightText="formData.licenseType" />
			<uni-list-item title="驾照证号" :rightText="formData.driverLicenseNo" />
			<uni-list-item title="驾龄" :rightText="formData.drivingYears" />
			<uni-list-item title="驾驶证起始日期" :rightText="formData.driverLicenseStartDate" />
			<uni-list-item title="驾驶证到期日期" :rightText="formData.driverLicenseExpireDate" />
			<uni-list-item title="车牌号" :rightText="formData.plateNumber" />
			<uni-list-item>
				<template v-slot:body>
					<text style="font-size: 14px;color: #3b4144;overflow: hidden;width: 90px;">相关资料</text>
				</template>
				<template v-slot:footer>
					<div style="flex: 1;">
						<myfilepicker readonly :fileIdString="formData.avatarAttachment" :fileMediatype="'image'"></myfilepicker>
						<myfilepicker readonly :fileIdString="formData.idCardAttachment" :fileMediatype="'image'"></myfilepicker>
						<myfilepicker readonly :fileIdString="formData.idCardReverseAttachment" :fileMediatype="'image'"></myfilepicker>
						<myfilepicker readonly :fileIdString="formData.driverLicenseAttachment" :fileMediatype="'image'"></myfilepicker>
						<myfilepicker readonly :fileIdString="formData.personWithCarAttachment" :fileMediatype="'image'"></myfilepicker>
						<myfilepicker readonly :fileIdString="formData.otherAttachment" :fileMediatype="'all'"></myfilepicker>
					</div>
				</template>
			</uni-list-item>
			<uni-list-item title="备注" :rightText="formData.remark" />
		</uni-list>
		<view style="height: 20px;"></view>
		<view v-if="driverLineList.length>0" style="position: relative;display: flex;flex-direction: row;align-items: center;padding: 12px 10px;font-weight: 400;">
			<view style="width: 4px;height: 12px;border-radius: 10px;background-color: #2979ff;margin-right: 6px"></view>
			<view style="display: flex;flex-direction: column;flex: 1;color: #333;">常跑路线</view>
		</view>
		<!-- <template v-if="driverLineList.length>0"><uni-tag style="margin-left: 15px;" :inverted="true" text="常跑路线" type="primary" /></template> -->
		<view v-for="(item,index) in driverLineList" :key="index" style="display: flex;flex-direction: row;padding: 10px;justify-content: space-between;background-color: white;margin: 10px;border-radius: 12px;">
			<view style="display: flex;flex-direction: column;">
				<view style="display: flex;align-items: center;">
					<view style="width: 25px;height: 25px;border: 1px solid rgb(91, 86, 86);display: flex;justify-content: center;align-items: center;">
						起
					</view>
					<view style="display: flex;flex-direction: column;margin-left: 10px;margin-right: 10px">
						<text>{{item.departDistrictName}}</text>
					</view>
				</view>
			    <view style="display: flex;align-items: center;margin-top: 15px;">
					<view style="width: 25px;height: 25px;border: 1px solid rgb(91, 86, 86);display: flex;justify-content: center;align-items: center;">
						止
					</view>
					<view style="display: flex;flex-direction: column;margin-left: 10px;margin-right: 10px">
						<text>{{item.arriveDistrictName}}</text>
					</view>
				</view>
			</view>
		</view>
		<view style="height: 50px;"></view>
	</div>
</template>

<script>
	import {
		getDriverDetails
	} from '@/api/system/driver.js'
	import {getDicts} from '@/api/system/dict.js'
	import myfilepicker from '@/components/uploadFile/uploadFile.vue'
	export default {
		components: {
			myfilepicker
		},
		data() {
			return {
				formData:{}, //详情
				//常跑路线
				driverLineList:[],
				// 性别->单选数据源
				sex_: [],
				//司机类型
				driverType_:[],
				//车辆类型
				carType_:[],
				
				driverId: '',
			}
		},
		onLoad(e) {
			if (e.driverId) {
				//设置顶部导航栏标题
				uni.showLoading({
					title: '正在加载',
				})
				this.driverId = e.driverId
				//获取司机详情
				getDriverDetails(e.driverId).then(res => {
					uni.hideLoading()
					if (res.code == '200') {
						this.formData = res.data||[]
						this.driverLineList=this.formData.driverLineList||[]
					} else {
						uni.hideLoading()
						uni.showToast({
							icon: 'none',
							title: res.msg
						})
					}
				})
			}
		},
		created() {
			//获取性别下拉框
			getDicts('sys_user_sex').then(res=>{
				res.data.forEach(item=>{
					this.sex_[item.dictValue]=item.dictLabel
				})
			})
			//获取司机类型下拉框
			getDicts('driver_type').then(res=>{
				res.data.forEach(item=>{
					this.driverType_[item.dictValue]=item.dictLabel
				})
			})
			//加载车辆类型
			getDicts('car_type').then(res=>{
				res.data.forEach(item=>{
					this.carType_[item.dictValue]=item.dictLabel
				})
			})
		},
		methods: {
		},
	}
</script>

<style scoped>
::v-deep .uni-list-item__extra{
	flex: 1;
}
</style>